package com.lingjtx.oss.common;

import net.coobird.thumbnailator.geometry.Positions;

public enum RegionPositions {
    TOP_LEFT("tl", Positions.TOP_LEFT),

    TOP_CENTER("tc", Positions.TOP_CENTER),

    TOP_RIGHT("tr", Positions.TOP_RIGHT),

    CENTER_LEFT("cl", Positions.CENTER_LEFT),

    CENTER("c", Positions.CENTER),

    CENTER_RIGHT("cr", Positions.CENTER_RIGHT),

    BOTTOM_LEFT("bl", Positions.BOTTOM_LEFT),

    BOTTOM_CENTER("bc", Positions.BOTTOM_CENTER),

    BOTTOM_RIGHT("br", Positions.BOTTOM_RIGHT),
    ;

    private final String name;

    private final Positions pos;

    RegionPositions(String name, Positions pos) {
        this.name = name;
        this.pos = pos;
    }

    public String getName() {
        return name;
    }

    public Positions getPos() {
        return pos;
    }

    public static RegionPositions of(String name) {
        for (RegionPositions value : RegionPositions.values()) {
            if (value.getName().equals(name)) {
                return value;
            }
        }
        return CENTER;
    }

    @Override
    public String toString() {
        return name;
    }
}
